<template>
    <div>
        <crumbs></crumbs>
        <h1>查询单个学生入学信息</h1>
        <el-form :inline="true" :model="formInline" class="demo-form-inline">
            <el-form-item>
                <el-input v-model="formInline.id" placeholder="请输入学号"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="onSubmit">查询</el-button>
            </el-form-item>
        </el-form>
        <div v-show="this.formInline.flag">
            <el-table :data="formInline.result" style="width: 100%">
                <el-table-column prop="stu_id" label="学号" width="180"></el-table-column>
                <el-table-column prop="stu_name" label="姓名" width="180"></el-table-column>
                <el-table-column prop="chinese"  label="语文"></el-table-column>
                <el-table-column prop="math"  label="数学"></el-table-column>
                <el-table-column prop="english" label="英语"></el-table-column>
                <el-table-column prop="lizong" label="理综"></el-table-column>
                <el-table-column prop="wenzong" label="文综"></el-table-column>
            </el-table>
        </div>
    </div>
</template>

<script>
import {search_entryExam_one} from '@/utils/examination.js';
import { Message } from 'element-ui';
    export default {
        data(){
            return{
                formInline: {
                    result:[],
                    id: '',
                    input:'',
                    flag:false
                },
            }
        },
        methods: {
            async onSubmit() {
                if(this.formInline.id == ''){
                    this.open4();
                }else{
                    this.formInline.flag = true;
                    let result = await search_entryExam_one({
                        method:'get',
                        url:`/search_entry/${this.formInline.id}`,
                        params:{},
                        headerType:'form'
                    })
                    console.log(result);
                    this.formInline.result = result;
                    console.log(this.formInline.result);
                }
            },
            open4() {
                Message.error('请填写学号！');
            }
        }
    }
</script>

<style lang="scss" scoped>
h1{
    font-size: 20px;
}
</style>